REM (C)2010-13 David Jones
REM Thanks to Mike Hall

set AppName=Compact13PrototypeApp

REM Compact13PrototypeApp
@echo on
@echo Executing CEContentWiz Postlink.bat
@echo http://CEContentWiz.codeplex.com
@echo .

if %_WINCEOSVER%WXYZ == WXYZ GOTO SKIP

if %_WINCEOSVER%WXYZ LSS 800 GOTO SKIP

REM call ..\..\Misc\BuildVSProject.bat

@echo copying Content Files from Resource Files folder to Targeted Debug Directory
if %_WINCEOSVER%==800 (
copy ".\Resources\*.*" "%SG_OUTPUT_ROOT%\oak\target\%_TGTCPU%\%WINCEDEBUG%"  /Y
@echo copying Content Files from Compact13Tools folder to Targeted Debug Directory
copy ..\..\Bin\%AppName%.exe "%SG_OUTPUT_ROOT%\oak\target\%_TGTCPU%\%WINCEDEBUG%"  /Y

) else (
echo Compact/CE Version:%_WINCEOSVER%  Not supported
GOTO SKIP
)

@echo .

@echo copying Content Files from Resource Files folder to FlatRelease Directory
rem copy "%BUILDROOT%\Resources\*.*" %_FLATRELEASEDIR%  /Y
if %_WINCEOSVER%==800 (
copy ".\Resources\*.*" %_FLATRELEASEDIR%  /Y
@echo copying Content Files from Compact13Tools folder to FlatRelease Directory
copy  ..\..\Bin\%AppName%.exe  %_FLATRELEASEDIR%  /Y
) else (
echo Compact/CE Version:%_WINCEOSVER%  Not supported
GOTO SKIP
)

@echo .
@echo Building .cab file
@echo .

PUSHD  %_FLATRELEASEDIR%
IF EXIST %AppName%.inf (
    cabwiz %AppName%.inf
	IF EXIST %AppName%.cab (
		@echo Generated .cab file: %AppName%p.cab in FLATRELEASEDIR.
	) else (
		@echo Generation of .cab file: C%AppName%.cab failed.
	)
	del %AppName%.inf
)else (
	@echo No file Compact13RunApp.inf for .cab file generation
)
 
POPD

@echo .
@echo Done Copying %AppName%
@echo .

GOTO DONE

:SKIP
@echo Only Windows Embedded Compact 2013 is supported


:DONE

